﻿using System;
using System.Collections.Generic;
using System.Text;

namespace LiveSearchPlugin
{
    public class LivePlugin : Plugins.IPlugin
    {
        public string LiveAppId
        {
            get
            {
                return System.Configuration.ConfigurationSettings.AppSettings["LiveAppId"];
            }
        }
        
        #region IPlugin Members

        LiveSearchService service = new LiveSearchService();

        public List<string> Command
        {
            get { return new List<string>() { "search" }; }
        }

        public string RootStore { get; set; }

        public string Name
        {
            get { return "Live Search"; }
        }

        public MSNPSharp.Messenger Messenger { get; set; }

        public string Chat(string Command, string UserID, string Input)
        {
            SearchRequest request = new SearchRequest();
            request.Adult = AdultOption.Off;
            request.AdultSpecified = true;
            request.AppId = LiveAppId;

            if (Command == "search")
            {
                request.Query = Input;
                SearchResponse response = service.Search(request);
                
            }
            return "";
        }

        #endregion
    }
}
